<template>
  <div class="login">
    <noscript>哦豁，没启用js哒</noscript>
    <div class="loginBox">
      <el-input class="el_inp" v-model="accountNum" placeholder="请输入用户名" @keyup.enter="submitLogin"></el-input>
      <el-input class="el_inp" v-model="passWord" placeholder="请输入用户名"></el-input>
      <el-button class="el_btn" @click="submitLogin">登录</el-button>
    </div>
  </div>
</template>

<script>
import LineDynamicBack from "../js/Line_dynamicBack"
export default {
  name: "login",
  data(){
    return{
      accountNum:"",
      passWord:"",
    }
  },
  components:{
  },
  mounted() {

  },
  methods:{
    submitLogin(){

      this.$store.dispatch('USER',{"accountNum":this.accountNum,"passWord":this.passWord}).then(res=> {
        if(res.success){

          this.$store.commit("account_num",this.accountNum)
          //每次登录前都清除数据
          sessionStorage.clear()
          this.$router.push({name:"HomeIO",params:{nickName:res.data[0].nickName,headImage:res.data[0].headImage}})
        }else{
          this.$message.error(res.msg);
        }
      })


    }
  },
}
</script>

<style lang="less" scoped>
body{
  width: 100%;
  height: 880px;
  .login{
    .loginBox{
      width: 30%;
      margin: 11rem auto;
      .el_inp{
        margin-top: 1rem;
      }
      .el_btn{
        width: 100%;
        color: #fff;
        margin-top: 1rem;
        background-image: linear-gradient(#BCE6FF, #88CDF6);
      }
    }
  }
}


</style>